<?php

function greengar_check_favorite($friendid, $userid, $app) {
    
    $isFavorite = greengar_check_relationship_favorite($userid, $friendid, $app, TRUE);
    $isFavoritor = greengar_check_relationship_favorite($friendid, $userid, $app, TRUE);
    
    
    
    if ($isFavorite && $isFavoritor) {
        $result = relationshipToArray($isFavorite);
        $result['relationship'] = 'both';
        return $result;
    } else {
        if ($isFavorite) {
            $result = relationshipToArray($isFavorite);
            $result['relationship'] = 'from';
        } else if ($isFavoritor) {
            $result = relationshipToArray($isFavoritor);
            $result['relationship'] = 'to';
        } else {
           return array(
            'guid' => -1,
            'relationship' => 'none'); 
        }
        
    }
    return $result;
}

?>